home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / Doubleshotz / Doubleshotz.dcr / Internal_5_Flash Cursor.ls < prev    next >
Encoding:
Text File  |  2007-09-27  |  2.4 KB  |  105 lines

  1. property pActive, pframecursor, pInitialized, pMember, pprevcursor, pSprite, pStateOK
  2.  
  3. on beginSprite me
  4.   pSprite = sprite(me.spriteNum)
  5.   pMember = pSprite.member
  6.   pStateOK = me.isStateOK(pMember, pSprite)
  7.   if pStateOK then
  8.     pInitialized = me.Initialize()
  9.   else
  10.     pInitialized = 0
  11.   end if
  12. end
  13.  
  14. on endSprite me
  15.   me.restorecursor()
  16. end
  17.  
  18. on mouseEnter me
  19.   pActive = 1
  20. end
  21.  
  22. on mouseLeave me
  23.   pActive = 0
  24.   me.restorecursor()
  25. end
  26.  
  27. on enterFrame me
  28.   if pStateOK then
  29.     if pInitialized then
  30.       if pActive then
  31.         me.setcursor()
  32.       end if
  33.     else
  34.       pInitialized = me.Initialize()
  35.     end if
  36.   else
  37.     pStateOK = me.isStateOK(pMember, pSprite)
  38.   end if
  39. end
  40.  
  41. on Initialize me
  42.   tinitialized = 1
  43.   pActive = 0
  44.   pframecursor = sprite(0).cursor
  45.   if pSprite.cursor <> pframecursor then
  46.     pprevcursor = pSprite.cursor
  47.   else
  48.     pprevcursor = pframecursor
  49.   end if
  50.   return tinitialized
  51. end
  52.  
  53. on isStateOK me, amember, asprite
  54.   tstateok = 1
  55.   return tstateok
  56. end
  57.  
  58. on restorecursor me
  59.   if pprevcursor <> pframecursor then
  60.     cursor(pframecursor)
  61.     pprevcursor = pframecursor
  62.   end if
  63. end
  64.  
  65. on setcursor me
  66.   tflashcursor = pSprite.getFlashProperty(EMPTY, #cursor)
  67.   case tflashcursor of
  68.     0:
  69.       tdirectorcursor = 200
  70.     1:
  71.       tdirectorcursor = -1
  72.     2:
  73.       tdirectorcursor = 280
  74.     3:
  75.       tdirectorcursor = 260
  76.     4:
  77.       tdirectorcursor = 1
  78.     otherwise:
  79.       tdirectorcursor = pSprite.cursor
  80.   end case
  81.   if pprevcursor <> tdirectorcursor then
  82.     cursor(tdirectorcursor)
  83.     pprevcursor = tdirectorcursor
  84.   end if
  85. end
  86.  
  87. on isOKToAttach me, aSpriteType, aSpriteNum
  88.   if aSpriteType = #graphic then
  89.     if sprite(aSpriteNum).member.type = #flash then
  90.       return 1
  91.     end if
  92.   end if
  93.   return 0
  94. end
  95.  
  96. on getBehaviorTooltip me
  97.   tString1 = "Allows Director's cursor to obey the Flash movie's cursor setting." & RETURN & RETURN & "PERMITTED SPRITE TYPES: Flash." & RETURN & RETURN & "USAGE: Apply to a Flash sprite. " & EMPTY & RETURN & RETURN & "DEPENDENCIES: None."
  98.   return tString1
  99. end
  100.  
  101. on getBehaviorDescription me
  102.   tString1 = "FLASH CURSOR" & RETURN & RETURN & "Drop the behavior onto a Flash sprite to allow Director to maintain the Flash movie's cursor settings." & RETURN & RETURN & "Apply this behavior to a Flash sprite." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "Flash" & RETURN & RETURN & "PARAMETERS:" & RETURN & "None."
  103.   return tString1
  104. end
  105.